package main

import (
	"fmt"
	"time"
)

func main() {
	c := make(chan int)
	d := make(chan int)
	o := make(chan bool)

	//fmt.Println(runtime.NumCPU())
	//fmt.Println(runtime.NumGoroutine())

	go func() {
		for {
			select {
			case v := <-c:
				println(v)
			case v := <-d:
				fmt.Println(v)
			case <-time.After(5 * time.Second):
				println("timeout")
				o <- true
				return
			}
		}
	}()
	fmt.Println("dd")
	c <- 10
	fmt.Println("ee")
	d <- 20
	<-o
}
